package com.fulu.game.bi.controller.roi;

import com.fulu.game.bi.common.controller.BaseController;
import com.fulu.game.bi.entity.po.roi.Delivery;
import com.fulu.game.bi.entity.vo.Result;
import com.fulu.game.bi.entity.vo.delivery.DeliveryDisplayVO;
import com.fulu.game.bi.entity.vo.delivery.DeliverySaveVO;
import com.fulu.game.bi.entity.vo.roi.RoiStatQueryVO;
import com.fulu.game.bi.redis.service.roi.DeliveryCostService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 投放费用管理
 */
@RestController
@RequestMapping("/api/v1/delivery")
public class DeliveryCostController extends BaseController {

    @Autowired
    private DeliveryCostService deliveryCostService;

    /**
     * 投放费用录入
     */
    @PostMapping("/save")
    public Result<Delivery> save(DeliverySaveVO vo) {
        Delivery res = deliveryCostService.save(vo);

        return Result.success().data(res).msg("保存成功");
    }

    /**
     * 查询投放记录
     */
    @PostMapping("/list")
    public Result<PageInfo<DeliveryDisplayVO>> list(RoiStatQueryVO vo) {
        PageInfo<DeliveryDisplayVO> page = deliveryCostService.list(vo);

        return Result.success().data(page).msg("查询成功");
    }


}
